#!/usr/bin/python3
# -*- coding: utf-8 -*-

import pandas as pd
import numpy  as np
import talib

def signal(*args):
    # Bias
    df = args[0]
    n = args[1]
    factor_name = args[2]

    bias36 = df['close'].rolling(3, min_periods=1).mean() - df['close'].rolling(6, min_periods=1).mean()
    df[factor_name] = bias36.rolling(n, min_periods=1).mean()

    return df
